import unittest

from model import business_lock_api as db_bussiness_lock
from object.multi_lock import DBMultiLock


class DBMultiLockTestCase(unittest.TestCase):
    def setUp(self) -> None:
        self.lock_values = ['07f4be950106a385b87e41984cc0e2a0', '07f4be950106a385b87e41984cc0e2aa', '407f4be950106a385b87e41984cc0e2ab',
                            '07f4be950106a385b87e41984cc0e2ac', '07f4be950106a385b87e41984cc0e2ad', '07f4be950106a385b87e41984cc0e2ae',
                            '07f4be950106a385b87e41984cc0e2af', '07f4be950106a385b87e41984cc0e2ah', '07f4be950106a385b87e41984cc0e2ai',
                            '07f4be950106a385b87e41984cc0e2ak']
        description = 'test'

        self.locks = DBMultiLock(params=self.lock_values, description=description, timeout=10)

    def test_acquire_locks(self):
        self.locks.acquire()
        locks = db_bussiness_lock.load_locks(self.lock_values)
        self.assertEqual(len(locks), len(self.lock_values))



if __name__ == '__main__':
    unittest.main()
